package com.example.springdemo0921.spring;

import com.example.springdemo0921.Person;
import com.example.springdemo0921.springboot.ProductRateConfig;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

@Getter
@Setter

/**
 * 导入对象的三种方法：
 *  ①、@import
 *  ①、@import ImportSelector实现类
 */
//@Import(Person.class)
//@Import(MyImportSelector.class)
@Import(MyRegister.class)

@Slf4j
public class JavaBean {
    private ProductRateConfig productRateConfig;


    @Bean
    public ProductRateConfig productRateConfig() {
        return productRateConfig;
    }

    @Bean
    public ProductRateConfig productRateConfig2() {
        ProductRateConfig productRateConfig = new ProductRateConfig();
        productRateConfig.setSensitiveWordSep("good good study");
        return productRateConfig;
    }






    @Override
    public String toString() {
        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
    }

}
